<?php
/**
 * Controller_Faq
 *
 * Класс Controller_Faq отвечает за обработку страниц, связанных с частыми вопросами
 *
 * @author Дмитрий Кузьма <kouzma.d@gmail.com>
 * @version 1.0
 */
class Controller_Faq extends Controller_Base {

	/**
	 * Выбор действия по URL
	 *
	 */
	public function action() {
		Service_Debug::setDebug();
		$this->showRightColumn = true;
		if (!empty($this->arrRequest[1])) $this->setError(404);
		else $this->actionIndex();
	}
 
	
 
	/**
	 * Страница поиска гостиниц
	 * 
	 */
	public function actionIndex() {
	  Service_Debug::setDebug();	  
	  $language = Service_Translate::getLang();
	  $objCurrentPage = new Article();
	  $objCurrentPage->find('first', array('select' => '`url`, `article_name_ru`, `article_name_en`, `title_ru`, `title_en`, `description_ru`, `description_en`, `keywords_ru`, `keywords_en`', 'conditions' => "`url` = 'faq.htm'"));
	  
	  $objFaq = new Faq();
	  $arrFaqs = $objFaq->find('all', array(
	    'select' => '`faq`.*, `faq_section`.`faq_section_name_ru`, `faq_section`.`faq_section_name_en`',
	    'joins' => 'LEFT JOIN `faq_section` ON `faq`.`ID_faq_section` = `faq_section`.`ID_faq_section`',
	    'order' => '`faq_section`.`ID_faq_section` ASC, `faq`.`ID_faq` ASC'
	  ));
		$this->showRightColumn = false;
	  $this->title = $objCurrentPage->getField('title_' . $language);
	  $this->pageHead = Service_Translate::getText('Вопрос-ответ');
	  $this->description = $objCurrentPage->getField('description_' . $language);
	  $this->keywords = $objCurrentPage->getField('keywords_' . $language);
	  $objViewFaq = new View_Faq();
	  $this->addJs('faq.js');
	  $this->addJs('plugins/jquery.auto_delete.js');
	  
	  $this->showHeader();
	  	echo '<div class="hotelParaments"></div>';
	    $objViewFaq->showList($arrFaqs);
		$this->showFooter();
	}  
}
?>